﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;
using System.Data.SqlClient;

using TimKen.App;
using TimKen.BussLogic;
using TimKen.DataEntity;

namespace TimKen.Web
{
    public partial class NewsDetail : TimKen.App.WebPage
    {
        public DataEntity.Article article;

        private int ArticleID;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Request.QueryString["ArticleID"] != null && TypeParse.IsNumeric(Request.QueryString["ArticleID"]))
                {
                    ArticleID = Convert.ToInt32(Request.QueryString["ArticleID"]);
                }
                else
                {
                    Response.Redirect("/Error.aspx");
                }

                BindData();
            }

        }

        private void BindData()
        {
            ArticleManager am = new ArticleManager();
            article = am.GetModel(ArticleID);
            if (article == null)
                Response.Redirect("/Error.aspx", true);
        }
    }
}